import 'package:flutter/material.dart';
import 'package:hbtrans_flutter/const.dart';

class Utils {
  static final String GET = "GET";
  static final String POST = "POST";
  static final String DATA = "data";
  static final String CODE = "code";
  static var codes = {0, 1, 200};

  static Utils _instance;

  static Utils getInstance() {
    if (_instance == null) {
      _instance = Utils();
    }
    return _instance;
  }

  convertToPeriodHour(int time) {
    int hour = time ~/ 45;
    int minutes = time - hour * 45;
    if (time <= 0) {
      hour = 0;
      minutes = 0;
    } else {
      hour = time ~/ 45;
      minutes = time - hour * 45;
    }

    return '$hour学时$minutes分钟';
  }

  showSnackBar(var scaffoldkey,String data) {
    scaffoldkey.currentState.showSnackBar(SnackBar(
        elevation: 0,
//        backgroundColor: Const.gold,
        content: Text(
          data,
          style: TextStyle(fontSize: 18),
        )));
  }

}
